package com.mdd.common.mapper.user;

import com.mdd.common.core.basics.IBaseMapper;
import com.mdd.common.entity.UserInvitation;
import com.mdd.common.vo.UserInvitationVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author shenjian
 * @createTime 2023年03月04日 16:03:00
 */
@Mapper
public interface UserInvitationMapper extends IBaseMapper<UserInvitation> {

    @Select("<script>" +
            "SELECT u.id as userId, u.nickname, u.avatar, lui.has_order as status\n" +
            "FROM ${prefix}user_invitation lui\n" +
            "LEFT JOIN ${prefix}user u ON u.id = lui.invitee_id \n" +
            "WHERE lui.inviter_id = #{userId}" +
            "</script>")
    List<UserInvitationVo> getUserInvitationList(Integer userId);
}
